package com.onenine.chat.commons;


import com.onenine.chat.model.RcExtra;

import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;

public interface IMessage {

    /**
     * 消息id
     */
    int getMsgId();

    /**
     * 消息发送者
     *
     * @return
     */
    IUser getFromUser();

    /**
     * 发送者用户id
     *
     * @return
     */
    String getSentUserId();

    /**
     * 消息类型
     */
    enum MessageType {
        EVENT,
        SEND_TEXT,
        RECEIVE_TEXT,

        SEND_IMAGE,
        RECEIVE_IMAGE,

        SEND_VOICE,
        RECEIVE_VOICE,

        SEND_VIDEO,
        RECEIVE_VIDEO,

        SEND_LOCATION,
        RECEIVE_LOCATION,

        SEND_FILE,
        RECEIVE_FILE,

        SEND_CUSTOM,
        RECEIVE_CUSTOM,

        FRIEND_APPLY,
        FRIEND_REFUSE,
        FRIEND_ALLOW,

        MessageType() {
        }
    }

    /**
     * 消息所属会话类型
     *
     * @return
     */
    Conversation.ConversationType getConversationType();

    /**
     * 消息事件类型
     *
     * @return integer
     */
    MessageType getMessageType();

    /**
     * 消息发送状态
     *
     * @return
     */
    Message.SentStatus getMsgSentStatus();

    /**
     * 消息接收状态
     *
     * @return
     */
    Message.ReceivedStatus getMsgReceiveStatus();

    /**
     * 文本消息内容
     *
     * @return
     */
    String getText();

    /**
     * 图片，音视频urk
     *
     * @return
     */
    String getMediaFilePath();

    /**
     * 音视频时长
     *
     * @return
     */
    long getDuration();

    /**
     * 消息到达时间戳
     *
     * @return
     */
    long getDatetime();

    /**
     * 获取附加信息
     *
     * @return
     */
    RcExtra getExtra();

    /**
     * 设置附加信息
     */
    void setExtra(RcExtra extra);
}
